rspec undefined local variable or method `class_nesting_depth`

Posted by unsorted on Stack Overflow See other posts from Stack Overflow or by unsorted
Published on 2011-01-11T04:50:35Z Indexed on 2011/01/11 4:53 UTC
Read the original article Hit count: 742

I'm using rails 3 w/ rspec-rails 2.4.1 and I get an error during model generation. Can't find anything from googling. Anyone know what might be going on?

TIA

$ rails g model CourseRating student_id:integer course_id:integer difficulty:integer usefulness:integer
  invoke  active_record
  create    db/migrate/20110111044035_create_course_ratings.rb
  create    app/models/course_rating.rb
  invoke    rspec
  create      spec/models/course_rating_spec.rb
(erb):1:in `template': undefined local variable or method `class_nesting_depth' for #<Rspec::Generators::ModelGenerator:0x0000010424e460> (NameError)
    from /Users/glurban/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/erb.rb:753:in `eval'
    from /Users/glurban/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/erb.rb:753:in `result'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:111:in `block in template'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in `call'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in `render'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `block (2 levels) in invoke!'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `open'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `block in invoke!'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `call'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `invoke_with_conflict_check'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/create_file.rb:61:in `invoke!'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions.rb:95:in `action'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/create_file.rb:26:in `create_file'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:110:in `template'
    from /Users/glurban/code/recruitd/lib/generators/rspec/model/model_generator.rb:10:in `create_test_file'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:109:in `invoke'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:269:in `block in _invoke_for_class_method'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/shell.rb:74:in `with_padding'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:258:in `_invoke_for_class_method'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:150:in `_invoke_from_option_test_framework'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:109:in `invoke'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:269:in `block in _invoke_for_class_method'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/shell.rb:74:in `with_padding'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:258:in `_invoke_for_class_method'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:150:in `_invoke_from_option_orm'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0/lib/rails/generators.rb:163:in `invoke'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0/lib/rails/commands/generate.rb:10:in `<top (required)>'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
    from /Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0/lib/rails/commands.rb:17:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails-3